package com.liujit.bms.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liujit.bms.app.domain.model.BlogArticleComment;
import com.liujit.bms.app.domain.query.BlogArticleCommentQuery;
import com.liujit.bms.app.domain.result.BlogArticleCommentResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @Description 博客文章评论Mapper
 * @Author liujun
 * @Date 2021-07-17 10:16:09
 */
@Mapper
public interface BlogArticleCommentMapper extends BaseMapper<BlogArticleComment> {

    /**
     * 分页查询
     *
     * @param page
     * @param query
     * @return
     * @author: liujun
     * @date: 2021/7/17 10:39 上午
     */
    IPage<BlogArticleCommentResult> selPage(Page<BlogArticleComment> page,
            @Param("query") BlogArticleCommentQuery query);

    /**
     * 添加评论量
     *
     * @param articleId
     * @return
     * @author: liujun
     * @date: 2021/7/18 11:25 上午
     */
    @Update("update blog_article set comment_num = comment_num + 1 where id = #{articleId}")
    Integer addCommentNum(Long articleId);
}